import router from '@/router'
import { Message } from 'element-ui'
const useSuccess = ({ message = '操作成功', routeName = null, onlyTip = false } = {}) => {
    console.log('message :>> ', message)
    Message({
        type: 'success',
        message
    })
    if (onlyTip) {
        return
    }
    if (routeName) {
        setTimeout(() => {
            router.push({
                name: routeName
            })
        }, 500)
        return
    }
    setTimeout(() => {
        router.go(-1)
    }, 500)
}

export default useSuccess
